Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

197
Visualizações
Getting: "Uncaught (in promise) TypeError: Cannot convert undefined or null to object" error when trying to register an account

I'm trying to get login system code working in vuejs, however when I try to register, it always gives this error:

Uncaught (in promise) TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at VueComponent.setErrors (vee-validate.esm.js?7bb1:1892) at eval (Register.vue?0103:282)

In vee-validate.esm.js, here's the part that shows the error:

        setErrors: function (errors) {
        var _this = this;
        Object.keys(errors).forEach(function (key) {
            var provider = _this.refs[key];
            if (!provider)
                return;
            var errorArr = errors[key] || [];
            errorArr = typeof errorArr === 'string' ? [errorArr] : errorArr;
            provider.setErrors(errorArr);
        });
        this.observers.forEach(function (observer) {
            observer.setErrors(errors);
        });
    }

And here's the part in register.view that shows the error:

            .catch((error) => {
          this.$toast({
            component: ToastificationContent,
            position: "top-right",
            props: {
              title: "Register failed!",
              icon: "CoffeeIcon",
              variant: "danger",
            },
          });

          error.hasOwnProperty("response")
            ? this.$refs.registerForm.setErrors(error.response.data.error)
            : this.$refs.registerForm.setErrors(error.error);
        }

I've tried adding if (errors != null) before the Object.keys(errors) part, but that only gets rid of the error message, however the code still doesn't run. I'm pretty new to vuejs so any help would be appreciated.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda